//
//  UIView+AutoTrack.m
//  APPDemo
//
//  Created by 郭红旗 on 2021/10/18.
//

#import "UIView+AutoTrack.h"

@implementation UIView (AutoTrack)

- (UIViewController *)sensorsdata_viewController {
    UIViewController *viewController = self.viewController;
    if (viewController == nil) {
        viewController = [UIApplication sharedApplication].windows.lastObject.rootViewController;
    }
    return viewController;
}


- (UIViewController*)viewController {
    for (UIView* next = [self superview]; next; next = next.superview) {
        UIResponder* nextResponder = [next nextResponder];
        if ([nextResponder isKindOfClass:[UIViewController
                                          class]]) {
            return (UIViewController*)nextResponder;
        }
    }
    return nil;
}

- (NSString *)sensorsdata_heatMapPath {
    /* 忽略路径
     UITableViewWrapperView 为 iOS11 以下 UITableView 与 cell 之间的 view
     */
    return  NSStringFromClass(self.class);
}

@end
